import React from "react";
import { connect } from "./connect";
function ConnectTest({ counter, info, handlerAddCount, handlerAddAge }) {
  return (
    <div>
      {counter.Count}
      <button onClick={handlerAddCount}>add</button>
    </div>
  );
}
const mapStateToProps = (state) => {
  return {
    counter: state.counter,
    info: state.info,
  };
};
const mapDispatchToProps = (dispatch) => {
  return {
    handlerAddCount: () => {
      dispatch({
        type: "addCount",
      });
    },
    handlerAddAge: () => {
      dispatch({
        type: "minCount",
      });
    },
  };
};

export default connect(mapStateToProps, mapDispatchToProps)(ConnectTest);
